{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-03-22T03:38:25.517192300Z",
     "start_time": "2024-03-22T03:38:25.385566200Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "\u001B[1;31mHello, world!\u001B[0m\n",
      "text/html": "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Hello, world!</span>\n</pre>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": "\u001B[3;34mThis is an example\u001B[0m\n",
      "text/html": "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #000080; text-decoration-color: #000080; font-style: italic\">This is an example</span>\n</pre>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from rich import print\n",
    "print(\"[bold red]Hello, world![/bold red]\")\n",
    "print(\"[italic blue]This is an example[/italic blue]\")"
   ]
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "\u001B[2;36m[19:09:26]\u001B[0m\u001B[2;36m \u001B[0m\u001B[1m{\u001B[0m\u001B[32m'id'\u001B[0m: \u001B[1;36m1\u001B[0m, \u001B[32m'name'\u001B[0m: \u001B[32m'azmat'\u001B[0m\u001B[1m}\u001B[0m                                                               \u001B]8;id=594946;file://C:\\Users\\lenovo\\AppData\\Local\\Temp\\ipykernel_20432\\3892412569.py\u001B\\\u001B[2m3892412569.py\u001B[0m\u001B]8;;\u001B\\\u001B[2m:\u001B[0m\u001B]8;id=49864;file://C:\\Users\\lenovo\\AppData\\Local\\Temp\\ipykernel_20432\\3892412569.py#6\u001B\\\u001B[2m6\u001B[0m\u001B]8;;\u001B\\\n\u001B[2;36m           \u001B[0m\u001B[34m╭─\u001B[0m\u001B[34m────────────────\u001B[0m\u001B[34m \u001B[0m\u001B[3;34mlocals\u001B[0m\u001B[34m \u001B[0m\u001B[34m─────────────────\u001B[0m\u001B[34m─╮\u001B[0m                                            \u001B[2m               \u001B[0m\n\u001B[2;36m           \u001B[0m\u001B[34m│\u001B[0m     \u001B[3;33mdict_one\u001B[0m\u001B[31m =\u001B[0m \u001B[1m{\u001B[0m\u001B[32m'id'\u001B[0m: \u001B[1;36m1\u001B[0m\u001B[1m}\u001B[0m                  \u001B[34m│\u001B[0m                                            \u001B[2m               \u001B[0m\n\u001B[2;36m           \u001B[0m\u001B[34m│\u001B[0m     \u001B[3;33mdict_two\u001B[0m\u001B[31m =\u001B[0m \u001B[1m{\u001B[0m\u001B[32m'name'\u001B[0m: \u001B[32m'azmat'\u001B[0m\u001B[1m}\u001B[0m          \u001B[34m│\u001B[0m                                            \u001B[2m               \u001B[0m\n\u001B[2;36m           \u001B[0m\u001B[34m│\u001B[0m \u001B[3;33mmerged_dicts\u001B[0m\u001B[31m =\u001B[0m \u001B[1m{\u001B[0m\u001B[32m'id'\u001B[0m: \u001B[1;36m1\u001B[0m, \u001B[32m'name'\u001B[0m: \u001B[32m'azmat'\u001B[0m\u001B[1m}\u001B[0m \u001B[34m│\u001B[0m                                            \u001B[2m               \u001B[0m\n\u001B[2;36m           \u001B[0m\u001B[34m╰───────────────────────────────────────────╯\u001B[0m                                            \u001B[2m               \u001B[0m\n",
      "text/html": "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">[19:09:26] </span><span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'id'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'name'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'azmat'</span><span style=\"font-weight: bold\">}</span>                                                               <a href=\"file://C:\\Users\\lenovo\\AppData\\Local\\Temp\\ipykernel_20432\\3892412569.py\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">3892412569.py</span></a><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">:</span><a href=\"file://C:\\Users\\lenovo\\AppData\\Local\\Temp\\ipykernel_20432\\3892412569.py#6\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">6</span></a>\n<span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">           </span><span style=\"color: #000080; text-decoration-color: #000080\">╭───────────────── </span><span style=\"color: #000080; text-decoration-color: #000080; font-style: italic\">locals</span><span style=\"color: #000080; text-decoration-color: #000080\"> ──────────────────╮</span>                                            <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">               </span>\n<span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">           </span><span style=\"color: #000080; text-decoration-color: #000080\">│</span>     <span style=\"color: #808000; text-decoration-color: #808000; font-style: italic\">dict_one</span><span style=\"color: #800000; text-decoration-color: #800000\"> =</span> <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'id'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span><span style=\"font-weight: bold\">}</span>                  <span style=\"color: #000080; text-decoration-color: #000080\">│</span>                                            <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">               </span>\n<span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">           </span><span style=\"color: #000080; text-decoration-color: #000080\">│</span>     <span style=\"color: #808000; text-decoration-color: #808000; font-style: italic\">dict_two</span><span style=\"color: #800000; text-decoration-color: #800000\"> =</span> <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'name'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'azmat'</span><span style=\"font-weight: bold\">}</span>          <span style=\"color: #000080; text-decoration-color: #000080\">│</span>                                            <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">               </span>\n<span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">           </span><span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-style: italic\">merged_dicts</span><span style=\"color: #800000; text-decoration-color: #800000\"> =</span> <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'id'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'name'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'azmat'</span><span style=\"font-weight: bold\">}</span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>                                            <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">               </span>\n<span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">           </span><span style=\"color: #000080; text-decoration-color: #000080\">╰───────────────────────────────────────────╯</span>                                            <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">               </span>\n</pre>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from rich.console import Console\n",
    "console = Console()\n",
    "\n",
    "def merge_dicts(dict_one, dict_two):\n",
    "    merged_dicts = dict_one | dict_two\n",
    "    console.log(merged_dicts,log_locals=True)\n",
    "    \n",
    "merge_dicts({\"id\":1},{\"name\":\"azmat\"})"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-21T11:09:26.339049600Z",
     "start_time": "2024-03-21T11:09:26.254033900Z"
    }
   },
   "id": "e438e052d29a76b8",
   "execution_count": 11
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "\u001B[34m╭─\u001B[0m\u001B[34m───────────────────────────────────\u001B[0m\u001B[34m \u001B[0m\u001B[1;34m<\u001B[0m\u001B[1;95mfunction\u001B[0m\u001B[39m print at \u001B[0m\u001B[1;36m0x00000214343A44A0\u001B[0m\u001B[1;34m>\u001B[0m\u001B[34m \u001B[0m\u001B[34m────────────────────────────────────\u001B[0m\u001B[34m─╮\u001B[0m\n\u001B[34m│\u001B[0m \u001B[3;96mdef \u001B[0m\u001B[1;31mprint\u001B[0m\u001B[1m(\u001B[0m*objects: Any, sep: str = \u001B[32m' '\u001B[0m, end: str = \u001B[32m'\\n'\u001B[0m, file: Optional\u001B[1m[\u001B[0mIO\u001B[1m[\u001B[0mstr\u001B[1m]\u001B[0m\u001B[1m]\u001B[0m = \u001B[3;35mNone\u001B[0m, flush: bool = \u001B[3;91mFalse\u001B[0m\u001B[1m)\u001B[0m  \u001B[34m│\u001B[0m\n\u001B[34m│\u001B[0m -> \u001B[3;35mNone\u001B[0m:                                                                                                        \u001B[34m│\u001B[0m\n\u001B[34m│\u001B[0m                                                                                                                 \u001B[34m│\u001B[0m\n\u001B[34m│\u001B[0m \u001B[36mPrint \u001B[0m\u001B[1;35mobject\u001B[0m\u001B[1;36m(\u001B[0m\u001B[36ms\u001B[0m\u001B[1;36m)\u001B[0m\u001B[36m supplied via positional arguments.\u001B[0m                                                              \u001B[34m│\u001B[0m\n\u001B[34m│\u001B[0m \u001B[36mThis function has an identical signature to the built-in print.\u001B[0m                                                 \u001B[34m│\u001B[0m\n\u001B[34m│\u001B[0m \u001B[36mFor more advanced features, see the :class:`~rich.console.Console` class.\u001B[0m                                       \u001B[34m│\u001B[0m\n\u001B[34m│\u001B[0m                                                                                                                 \u001B[34m│\u001B[0m\n\u001B[34m│\u001B[0m \u001B[1;36m37\u001B[0m\u001B[3m attribute(s) not shown.\u001B[0m Run \u001B[1;35minspect\u001B[0m\u001B[1m(\u001B[0minspect\u001B[1m)\u001B[0m for options.                                                    \u001B[34m│\u001B[0m\n\u001B[34m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001B[0m\n",
      "text/html": "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #000080; text-decoration-color: #000080\">╭──────────────────────────────────── </span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">function</span><span style=\"color: #000000; text-decoration-color: #000000\"> print at </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0x00000214343A44A0</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">&gt;</span><span style=\"color: #000080; text-decoration-color: #000080\"> ─────────────────────────────────────╮</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #00ffff; text-decoration-color: #00ffff; font-style: italic\">def </span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">print</span><span style=\"font-weight: bold\">(</span>*objects: Any, sep: str = <span style=\"color: #008000; text-decoration-color: #008000\">' '</span>, end: str = <span style=\"color: #008000; text-decoration-color: #008000\">'\\n'</span>, file: Optional<span style=\"font-weight: bold\">[</span>IO<span style=\"font-weight: bold\">[</span>str<span style=\"font-weight: bold\">]]</span> = <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>, flush: bool = <span style=\"color: #ff0000; text-decoration-color: #ff0000; font-style: italic\">False</span><span style=\"font-weight: bold\">)</span>  <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span> -&gt; <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>:                                                                                                        <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span>                                                                                                                 <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #008080; text-decoration-color: #008080\">Print </span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">object</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080\">s</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">)</span><span style=\"color: #008080; text-decoration-color: #008080\"> supplied via positional arguments.</span>                                                              <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #008080; text-decoration-color: #008080\">This function has an identical signature to the built-in print.</span>                                                 <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #008080; text-decoration-color: #008080\">For more advanced features, see the :class:`~rich.console.Console` class.</span>                                       <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span>                                                                                                                 <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">37</span><span style=\"font-style: italic\"> attribute(s) not shown.</span> Run <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">inspect</span><span style=\"font-weight: bold\">(</span>inspect<span style=\"font-weight: bold\">)</span> for options.                                                    <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n<span style=\"color: #000080; text-decoration-color: #000080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n</pre>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from rich import inspect\n",
    "inspect(print, methods=True)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-22T03:43:41.585228500Z",
     "start_time": "2024-03-22T03:43:41.503767900Z"
    }
   },
   "id": "490d136471171293",
   "execution_count": 2
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "Root\n├── Child 1\n├── Child 2\n│   └── Grandchild\n└── Child 3\n    └── Grandchild 1\n        └── Great Grandchild\n",
      "text/html": "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Root\n├── Child 1\n├── Child 2\n│   └── Grandchild\n└── Child 3\n    └── Grandchild 1\n        └── Great Grandchild\n</pre>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from rich.tree import Tree\n",
    "from rich import print as rprint\n",
    "tree = Tree(\"Root\")\n",
    "tree.add(\"Child 1\")\n",
    "tree.add(\"Child 2\").add(\"Grandchild\")\n",
    "tree.add(\"Child 3\").add(\"Grandchild 1\").add(\"Great Grandchild\")\n",
    "\n",
    "rprint(tree)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-22T03:46:03.636359300Z",
     "start_time": "2024-03-22T03:46:03.580328Z"
    }
   },
   "id": "102ce7755536201c",
   "execution_count": 3
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-22T03:33:14.563099200Z",
     "start_time": "2024-03-22T03:33:14.496042100Z"
    }
   },
   "id": "87290a7e4d6d7f92",
   "execution_count": null
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-22T03:33:11.207165700Z",
     "start_time": "2024-03-22T03:33:11.198166100Z"
    }
   },
   "id": "288b0c1959d5ddf6",
   "execution_count": null
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "1ecf5ff524fcce66"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
